package afeng.run.jenkinsdemodeploy.controller;

import afeng.run.jenkinsdemodeploy.model.CameraInfo;
import afeng.run.jenkinsdemodeploy.service.CameraService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Slf4j
@Controller
public class CameraMintorController {

    @Autowired
    private CameraService cameraService;

    @RequestMapping("/getCameraList")
    public ModelAndView getCameraList(Model model){
        List<CameraInfo> cameraInfoList = cameraService.getCameraInfoList();
        model.addAttribute("userList",cameraInfoList);
        model.addAttribute("title","摄像头地址管理");
        return new ModelAndView("camera_list","userModel",model);
    }
}
